//class Person{};
//class Student{};
//public class Main {
//    public static void main(String[] args) {
//        function(new Person());
//        function(new Student());
//    }
//
//    public static void function(Object obj){
//        System.out.println(obj);
//    }
//}

//import java.util.Objects;
////
////class Person{
////    public String name;
////    public int age;
////
////    @Override
////    public boolean equals(Object object) {
////        if (this == object) return true;
////        if (object == null || getClass() != object.getClass()) return false;
////        Person person = (Person) object;
////        return age == person.age && Objects.equals(name, person.name);
////    }
////
////    @Override
////    public int hashCode() {
////        return Objects.hash(name, age);
////    }
////
////    @Override
////    public String toString() {
////        return "Person{" +
////                "name='" + name + '\'' +
////                ", age=" + age +
////                '}';
////    }
////
////    public Person(String name, int age) {
////        this.name = name;
////        this.age = age;
////    }
////}
////
////public class Main {
////    public static void main(String[] args) {
////        Person person = new Person("帅哥", 18);
////        Person person1 = new Person("帅哥",18);
////        System.out.println(person.equals(person1));
////    }
////}

//import java.util.Arrays;
//
//class Student implements Comparable<Student> {
//    public String name;
//    public int age;
//
//    public Student(String name, int age) {
//        this.name = name;
//        this.age = age;
//    }
//
//    @Override
//    public String toString() {
//        return "Student{" +
//                "name='" + name + '\'' +
//                ", age=" + age +
//                '}';
//    }
//
//    @Override
//    public int compareTo(Student o) {
//        if (this.age > o.age) {
//            return 1;
//        } else if (this.age < o.age) {
//            return -1;
//        } else {
//            return 0;
//        }
//    }
//}
//public class Main {
//
//    public static void main(String[] args) {
////        Student student1 = new Student("zhangsan", 10);
////        Student student2 = new Student("lisi", 15);
////        System.out.println(student1.compareTo(student2));
//        Student[] students = new Student[3];
//        students[0] = new Student("张三" , 18);
//        students[1] = new Student("李四" , 21);
//        students[2] = new Student("王五" , 19);
//        Arrays.sort(students);
//        System.out.println(Arrays.toString(students));
//    }
//}


//class Student implements Comparable<Student>{
//    public String name;
//    public int age;
//
//    public Student(String name, int age) {
//        this.name = name;
//        this.age = age;
//    }
//
//    @Override
//    public String toString() {
//        return "Student{" +
//                "name='" + name + '\'' +
//                ", age=" + age +
//                '}';
//    }
//
//    public int compareTo(Student o) {
//        return this.age - o.age;
//    }
//}
//
//public class Main {
//
//    public static void main(String[] args) {
//        Student student1 = new Student("zhangsan", 10);
//        Student student2 = new Student("lisi", 15);
//        System.out.println(student1.compareTo(student2));
//    }
//}

class Money implements Cloneable{
    public double money = 19.9;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
class Person implements Cloneable{
    public int age;
    public Money m;
    public Person(int age) {
        this.age = age;
        this.m = new Money();
    }
    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person tmp = (Person) super.clone();
        tmp.m = (Money) this.m.clone();
        return tmp;
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                '}';
    }
}

public class Main {
    public static void main(String[] args) throws CloneNotSupportedException{
        Person person1 = new Person(10);
        Person person2 = (Person)person1.clone();
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
        person2.m.money = 99.99;
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
        System.out.println("哈哈");
        System.out.println("hehe");
    }
}